//
//  UIBarButtonItem+XHExtension.m
//  BSNoAnswer
//
//  Created by Tiffany宝 on 16/5/13.
//  Copyright © 2016年 Tiffany. All rights reserved.
//

#import "UIBarButtonItem+XHExtension.h"

@implementation UIBarButtonItem (XHExtension)

+(instancetype)itemWithImage:(NSString *)image highlightedImage:(NSString *)highligtedImage target:(id)target selector:(SEL)selector{
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setBackgroundImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageNamed:highligtedImage] forState:UIControlStateHighlighted];
    [button sizeToFit];
    [button addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
    return [[self alloc]initWithCustomView:button];
}

@end
